export const mixin = {
  methods: {
    //获取图片地址
    attachImageUrl(url) {
      return  this.$store.state.configure.HOST+`${url}`;
    },

    //获取名字前半部分--歌手名
    replaceLName(str) {
      let arr = str.split('-');
      return arr[0];
    },
    //获取名字后半部分--歌名
    replaceFName(str) {
      let arr = str.split('-');
      return arr[1];
    },
    //播放
    toplay: function (id, url, pic, index, name, lyric) {
      this.$store.commit('setId', id);
      this.$store.commit('setUrl', this.$store.state.configure.HOST + url);
      this.$store.commit('setPicUrl', this.$store.state.configure.HOST + pic);
      this.$store.commit('setListIndex', index);
      this.$store.commit('setTitle', this.replaceFName(name));
      this.$store.commit('setArtist', this.replaceLName(name));
      this.$store.commit('setLyric', lyric);

    }
  }
}
